<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateMaterialFlowTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('material_flow', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('material_id',false)->default(0)->comment('材料id');
            $table->unsignedBigInteger('material_assign_id',false)->default(0)->comment('材料分配id');
            $table->unsignedTinyInteger('flow_type',false)->default(0)->comment('流程类型');
            $table->unsignedBigInteger('from_admin_id',false)->default(0)->comment('来自管理员id');
            $table->unsignedBigInteger('from_data_id',false)->default(0)->comment('来自节点id');
            $table->tinyInteger('from_data_type',false)->default(0)->comment('来自节点类型');
            $table->unsignedBigInteger('to_data_id',false)->default(0)->comment('发往节点id');
            $table->tinyInteger('to_data_type',false)->default(0)->comment('发往节点类型');
            $table->tinyInteger('status',false)->default(0)->comment('状态');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('material_flow');
    }
}
